#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from flask import jsonify

from blog.extenstion import db
from blog.user import user
from blog.user.Models import User

__author__ = 'Tim Yao'


@user.route('/index')
def index():
    result = db.session.execute('select title, text from entry order by id desc')

    # entries = [dict(title=row[0], text=row[1]) for row in cur.fetchall()]
    user = db.session.query(User).filter_by(id=1).first()
    return jsonify(dict(user.name))